﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using KeaoBase;

namespace KeaoDataService
{
    public partial class HunNingTuJiHuaLiang : Form
    {
        public HunNingTuJiHuaLiang()
        {
            InitializeComponent();
        }

        private DataGridViewRow m_CurrentRow;

        public HunNingTuJiHuaLiang(DataGridViewRow Row)
        {
            InitializeComponent();
            m_CurrentRow = Row;
        }

        private void HunNingTuJiHuaLiang_Load(object sender, EventArgs e)
        {

            if (m_CurrentRow != null)
            {
 
            }

            if (KeaoUtils.ConfigGetNodeAttr("沙石料1", "状态") == "禁用")
            {
                txt_shashiliao_1.Enabled = false;
                txt_shashiliao_1.Text = "0";
            }
            if (KeaoUtils.ConfigGetNodeAttr("沙石料2", "状态") == "禁用")
            {
                txt_shashiliao_2.Enabled = false;
                txt_shashiliao_2.Text = "0";
            }
            if (KeaoUtils.ConfigGetNodeAttr("沙石料3", "状态") == "禁用")
            {
                txt_shashiliao_3.Enabled = false;
                txt_shashiliao_3.Text = "0";
            }
            if (KeaoUtils.ConfigGetNodeAttr("沙石料4", "状态") == "禁用")
            {
                txt_shashiliao_4.Enabled = false;
                txt_shashiliao_4.Text = "0";
            }
            if (KeaoUtils.ConfigGetNodeAttr("沙石料5", "状态") == "禁用")
            {
                txt_shashiliao_5.Enabled = false;
                txt_shashiliao_5.Text = "0";
            }
            if (KeaoUtils.ConfigGetNodeAttr("沙石料6", "状态") == "禁用")
            {
                txt_shashiliao_6.Enabled = false;
                txt_shashiliao_6.Text = "0";
            }
            if (KeaoUtils.ConfigGetNodeAttr("沙石料7", "状态") == "禁用")
            {
                txt_shashiliao_7.Enabled = false;
                txt_shashiliao_7.Text = "0";
            }
            if (KeaoUtils.ConfigGetNodeAttr("沙石料8", "状态") == "禁用")
            {
                txt_shashiliao_8.Enabled = false;
                txt_shashiliao_8.Text = "0";
            }

            if (KeaoUtils.ConfigGetNodeAttr("粉料1", "状态") == "禁用")
            {
                txt_fenliao_1.Enabled = false;
                txt_fenliao_1.Text = "0";
            }
            if (KeaoUtils.ConfigGetNodeAttr("粉料2", "状态") == "禁用")
            {
                txt_fenliao_2.Enabled = false;
                txt_fenliao_2.Text = "0";
            }
            if (KeaoUtils.ConfigGetNodeAttr("粉料3", "状态") == "禁用")
            {
                txt_fenliao_3.Enabled = false;
                txt_fenliao_3.Text = "0";
            }
            if (KeaoUtils.ConfigGetNodeAttr("粉料4", "状态") == "禁用")
            {
                txt_fenliao_4.Enabled = false;
                txt_fenliao_4.Text = "0";
            }
            if (KeaoUtils.ConfigGetNodeAttr("粉料5", "状态") == "禁用")
            {
                txt_fenliao_5.Enabled = false;
                txt_fenliao_5.Text = "0";
            }
            if (KeaoUtils.ConfigGetNodeAttr("粉料6", "状态") == "禁用")
            {
                txt_fenliao_6.Enabled = false;
                txt_fenliao_6.Text = "0";
            }
            if (KeaoUtils.ConfigGetNodeAttr("粉料7", "状态") == "禁用")
            {
                txt_fenliao_7.Enabled = false;
                txt_fenliao_7.Text = "0";
            }
            if (KeaoUtils.ConfigGetNodeAttr("粉料8", "状态") == "禁用")
            {
                txt_fenliao_8.Enabled = false;
                txt_fenliao_8.Text = "0";
            }

            if (KeaoUtils.ConfigGetNodeAttr("外加剂1", "状态") == "禁用")
            {
                txt_waijiaji_1.Enabled = false;
                txt_waijiaji_1.Text = "0";
            }
            if (KeaoUtils.ConfigGetNodeAttr("外加剂2", "状态") == "禁用")
            {
                txt_waijiaji_2.Enabled = false;
                txt_waijiaji_2.Text = "0";
            }
            if (KeaoUtils.ConfigGetNodeAttr("外加剂3", "状态") == "禁用")
            {
                txt_waijiaji_3.Enabled = false;
                txt_waijiaji_3.Text = "0";
            }
            if (KeaoUtils.ConfigGetNodeAttr("外加剂4", "状态") == "禁用")
            {
                txt_waijiaji_4.Enabled = false;
                txt_waijiaji_4.Text = "0";
            }
            if (KeaoUtils.ConfigGetNodeAttr("外加剂5", "状态") == "禁用")
            {
                txt_waijiaji_5.Enabled = false;
                txt_waijiaji_5.Text = "0";
            }

            if (KeaoUtils.ConfigGetNodeAttr("水1", "状态") == "禁用")
            {
                txt_shui_1.Enabled = false;
                txt_shui_1.Text = "0";
            }
            if (KeaoUtils.ConfigGetNodeAttr("水2", "状态") == "禁用")
            {
                txt_shui_2.Enabled = false;
                txt_shui_2.Text = "0";
            }
        }

        private void menu_btn_shezhi_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txt_peizhidan.Text))
            {
                KeaoUtils.ShowInfoMessage("配置单名称不能为空，请检查重试。");
                return;
            }

            if (m_CurrentRow != null)
            {

            }
            else
            {
                TableRow newRow = new TableRow("tbl_hunningtupeibi",Guid.NewGuid().ToString(), DBCtl.插入);
                newRow.DataCols.Add(new TableCol() { ColName="mingcheng", ValueMember=txt_peizhidan.Text, ValueType = DataValueCommonType.字符串 });
                newRow.DataCols.Add(new TableCol() { ColName = "gl1", ValueMember = txt_peizhidan.Text, ValueType = DataValueCommonType.字符串 });
                newRow.DataCols.Add(new TableCol() { ColName = "gl2", ValueMember = txt_shashiliao_1.Text, ValueType = DataValueCommonType.字符串 });
                newRow.DataCols.Add(new TableCol() { ColName = "gl3", ValueMember = txt_shashiliao_2.Text, ValueType = DataValueCommonType.字符串 });
                newRow.DataCols.Add(new TableCol() { ColName = "gl4", ValueMember = txt_shashiliao_3.Text, ValueType = DataValueCommonType.字符串 });
                newRow.DataCols.Add(new TableCol() { ColName = "gl5", ValueMember = txt_shashiliao_4.Text, ValueType = DataValueCommonType.字符串 });
                newRow.DataCols.Add(new TableCol() { ColName = "gl6", ValueMember = txt_shashiliao_5.Text, ValueType = DataValueCommonType.字符串 });
                newRow.DataCols.Add(new TableCol() { ColName = "gl7", ValueMember = txt_shashiliao_6.Text, ValueType = DataValueCommonType.字符串 });
                newRow.DataCols.Add(new TableCol() { ColName = "gl8", ValueMember = txt_shashiliao_7.Text, ValueType = DataValueCommonType.字符串 });
                newRow.DataCols.Add(new TableCol() { ColName = "fl1", ValueMember = txt_fenliao_1.Text, ValueType = DataValueCommonType.字符串 });
                newRow.DataCols.Add(new TableCol() { ColName = "fl2", ValueMember = txt_fenliao_2.Text, ValueType = DataValueCommonType.字符串 });
                newRow.DataCols.Add(new TableCol() { ColName = "fl3", ValueMember = txt_fenliao_3.Text, ValueType = DataValueCommonType.字符串 });
                newRow.DataCols.Add(new TableCol() { ColName = "fl4", ValueMember = txt_fenliao_4.Text, ValueType = DataValueCommonType.字符串 });
                newRow.DataCols.Add(new TableCol() { ColName = "fl5", ValueMember = txt_fenliao_5.Text, ValueType = DataValueCommonType.字符串 });
                newRow.DataCols.Add(new TableCol() { ColName = "fl6", ValueMember = txt_fenliao_6.Text, ValueType = DataValueCommonType.字符串 });
                newRow.DataCols.Add(new TableCol() { ColName = "fl7", ValueMember = txt_fenliao_7.Text, ValueType = DataValueCommonType.字符串 });
                newRow.DataCols.Add(new TableCol() { ColName = "fl8", ValueMember = txt_fenliao_8.Text, ValueType = DataValueCommonType.字符串 });
                newRow.DataCols.Add(new TableCol() { ColName = "wjj1", ValueMember = txt_waijiaji_1.Text, ValueType = DataValueCommonType.字符串 });
                newRow.DataCols.Add(new TableCol() { ColName = "wjj2", ValueMember = txt_waijiaji_2.Text, ValueType = DataValueCommonType.字符串 });
                newRow.DataCols.Add(new TableCol() { ColName = "wjj3", ValueMember = txt_waijiaji_3.Text, ValueType = DataValueCommonType.字符串 });
                newRow.DataCols.Add(new TableCol() { ColName = "wjj4", ValueMember = txt_waijiaji_4.Text, ValueType = DataValueCommonType.字符串 });
                newRow.DataCols.Add(new TableCol() { ColName = "wjj5", ValueMember = txt_waijiaji_5.Text, ValueType = DataValueCommonType.字符串 });
                newRow.DataCols.Add(new TableCol() { ColName = "s1", ValueMember = txt_shui_1.Text, ValueType = DataValueCommonType.字符串 });
                newRow.DataCols.Add(new TableCol() { ColName = "s2", ValueMember = txt_shui_2.Text, ValueType = DataValueCommonType.字符串 });
                KeaoUtils._DB.SaveTableRows(newRow);
            }
        }


    }
}
